﻿#ifndef VIDEOSURFACE_H
#define VIDEOSURFACE_H

#include <QAbstractVideoSurface>

class QCamera;
class QVideoFrame;

class  VideoSurface:public QAbstractVideoSurface{
    Q_OBJECT
public:
    // 设置surface只能有一个，意味着默认的surface将不能再使用，二选一的
    explicit VideoSurface(QObject *parent = 0):QAbstractVideoSurface(parent){}

    QList<QVideoFrame::PixelFormat> supportedPixelFormats(
            QAbstractVideoBuffer::HandleType handleType = QAbstractVideoBuffer::NoHandle) const override;

    bool setSource(QCamera *pCamera);

signals:
    //视频帧捕获信号
    void generateFrame(const QVideoFrame &frame);
private slots:
    bool present(const QVideoFrame &frame) override;
};

#endif // VIDEOSURFACE_H
